home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 103
/
Vol 103.iso
/
interfac
/
it.dig
/
scripts
/
__Packages
/
mx
/
controls
/
UIScrollBar.as
< prev
next >
Wrap
Text File
|
2010-03-13
|
7KB
|
243 lines
class mx.controls.UIScrollBar extends mx.controls.scrollClasses.ScrollBar
{
static var symbolName = "UIScrollBar";
static var symbolOwner = mx.controls.UIScrollBar;
var className = "UIScrollBar";
var clipParameters = {_targetInstanceName:1,horizontal:1};
static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.UIScrollBar.prototype.clipParameters);
static var version = "2.0.2.126";
function UIScrollBar()
{
super();
}
function init(Void)
{
super.init();
this.textField.owner = this;
this.__set__horizontal(this.wasHorizontal);
if(this.__get__horizontal())
{
this.textField == undefined ? super.setSize(this.__width,this.__height) : super.setSize(this.textField._width,16);
}
else
{
this.textField == undefined ? super.setSize(this.__width,this.__height) : super.setSize(16,this.textField._height);
}
if(this.__get__horizontal())
{
var _loc3_ = this.__width;
this.__height = this.__width;
this.width = _loc3_;
this.__width = 16;
}
this.textField.onScroller = function()
{
this.hPosition = this.hscroll;
this.vPosition = this.scroll - 1;
};
if(this.__get___targetInstanceName() != undefined)
{
this.setScrollTarget(this.__get___targetInstanceName());
this.__get___targetInstanceName().addListener(this);
}
}
function get _targetInstanceName()
{
return this.textField;
}
function get height()
{
if(this.wasHorizontal)
{
return this.__width;
}
return this.__height;
}
function get width()
{
if(this.wasHorizontal)
{
return this.__height;
}
return this.__width;
}
function size(Void)
{
super.size();
this.onTextChanged();
}
function draw()
{
super.draw();
}
function set _targetInstanceName(t)
{
if(t == undefined)
{
this.textField.removeListener(this);
delete this.textField[!this.__get__horizontal() ? "vScroller" : "hScroller"];
if(this.textField.hScroller != undefined && this.textField.vScroller != undefined)
{
this.textField.unwatch("text");
this.textField.unwatch("htmltext");
}
}
var _loc3_ = this._parent[t];
this.textField = this._parent[t];
this.onTextChanged();
}
function setSize(w, h)
{
if(this.__get__horizontal())
{
super.setSize(h,w);
}
else
{
super.setSize(w,h);
}
}
function onTextChanged(Void)
{
if(this.textField == undefined)
{
return undefined;
}
clearInterval(this.synchScroll);
if(this.__get__horizontal())
{
var _loc2_ = this.textField.hscroll;
this.setScrollProperties(this.textField._width,0,this.textField.maxhscroll);
this.__set__scrollPosition(Math.min(_loc2_,this.textField.maxhscroll));
}
else
{
_loc2_ = this.textField.scroll;
var _loc3_ = this.textField.bottomScroll - this.textField.scroll;
this.setScrollProperties(_loc3_,1,this.textField.maxscroll);
this.__set__scrollPosition(Math.min(_loc2_,this.textField.maxscroll));
}
}
function get horizontal()
{
return this.wasHorizontal;
}
function set horizontal(v)
{
this.wasHorizontal = v;
if(v and this.initializing)
{
if(this._rotation == 90)
{
return undefined;
}
this._xscale = -100;
this._rotation = -90;
}
if(!this.initializing)
{
if(v)
{
if(this._rotation == 0)
{
this._rotation = -90;
this._xscale = -100;
}
}
else if(this._rotation == -90)
{
this._rotation = 0;
this._xscale = 100;
}
}
}
function callback(prop, oldval, newval)
{
clearInterval(this.hScroller.synchScroll);
clearInterval(this.vScroller.synchScroll);
this.hScroller.synchScroll = setInterval(this.hScroller,"onTextChanged",50);
this.vScroller.synchScroll = setInterval(this.vScroller,"onTextChanged",50);
return newval;
}
function setScrollTarget(tF)
{
if(tF == undefined)
{
this.textField.removeListener(this);
delete this.textField[!this.__get__horizontal() ? "vScroller" : "hScroller"];
if(this.textField.hScroller != undefined && this.textField.vScroller != undefined)
{
this.textField.unwatch("text");
this.textField.unwatch("htmltext");
}
}
this.textField = undefined;
if(!(tF instanceof TextField))
{
return undefined;
}
this.textField = tF;
if(this.__get__horizontal())
{
this.textField.hScroller = this;
this.textField.hScroller.lineScrollSize = 5;
}
else
{
this.textField.vScroller = this;
this.textField.vScroller.lineScrollSize = 1;
}
this.onTextChanged();
this.onChanged = function(Void)
{
this.onTextChanged();
};
this.onScroller = function(Void)
{
if(!this.isScrolling)
{
if(!this.horizontal)
{
this.scrollPosition = this.textField.scroll;
}
else
{
this.scrollPosition = this.textField.hscroll;
}
}
};
this.textField.addListener(this);
this.textField.watch("text",this.callback);
this.textField.watch("htmlText",this.callback);
}
function scrollHandler(Void)
{
if(this.__get__horizontal())
{
var _loc2_ = this.textField.background;
this.textField.hscroll = this.scrollPosition;
this.textField.background = _loc2_;
}
else
{
this.textField.scroll = this.scrollPosition;
}
}
function setEnabled(enable)
{
super.setEnabled(enable);
if(enable)
{
this.textField.addListener(this);
}
else
{
this.textField.removeListener();
}
}
function dispatchScrollEvent(detail)
{
this.dispatchEvent({type:"scroll"});
}
}